
. set more off

. 
. 
. clear

. use "main_analyses_and_supplemental_tables.dta" 

. 
. keep if main_sample==1
(3,213 observations deleted)

. keep countryname year  president_fixed

. save "./working data/henisz_analysis_country_years.dta", replace
file ./working data/henisz_analysis_country_years.dta saved

. 
. 
. clear

. 
. use "POLCON_2017.dta"

. gen countryname =polity_country
(1,193 missing values generated)

. replace countryname="Dominican Republic" if countryname=="Dominican Rep"
(173 real changes made)

. replace countryname="Congo, Rep." if countryname=="Congo, Brazzaville"
(56 real changes made)

. replace countryname="Cote d'Ivoire" if countryname=="Ivory Coast"
(57 real changes made)

. replace countryname="Gambia, The" if countryname=="Gambia"
(52 real changes made)

. replace countryname="Kyrgyz Republic" if countryname=="Kyrgyzstan"
(26 real changes made)

. replace countryname="North Macedonia" if countryname=="Macedonia"
(26 real changes made)

. replace countryname="South Korea" if countryname=="Korea, South"
(69 real changes made)

. 
. drop if countryname==""
(1,193 observations deleted)

. drop if year<1975 |year>2016
(10,292 observations deleted)

. 
. save "./working data/polcon_2017_wd.dta", replace
file ./working data/polcon_2017_wd.dta saved

. 
. gen oecd=0

. replace oecd =1 if countryname=="United States" |countryname=="Austria" |countryname=="Belgium" |countryname=="Canada" 
(168 real changes made)

. replace oecd =1 if countryname=="Netherlands" |countryname=="Greece" |countryname=="Sweden" |countryname=="Luxembourg" 
(168 real changes made)

. replace oecd =1 if countryname=="Switzerland" |countryname=="Norway" |countryname=="Turkey" |countryname=="Iceland" 
(168 real changes made)

. replace oecd =1 if countryname=="Denmark" |countryname=="Ireland" |countryname=="Portugal" |countryname=="United Kingdom" 
(168 real changes made)

. replace oecd =1 if countryname=="France" |countryname=="Italy" |countryname=="Spain" |countryname=="Germany" 
(153 real changes made)

. replace oecd =1 if countryname=="Chile" &year> 2010
(6 real changes made)

. replace oecd =1 if countryname=="Czech Republic" &year> 2010
(6 real changes made)

. replace oecd =1 if countryname=="Finland"
(42 real changes made)

. replace oecd =1 if countryname=="Israel" &year> 2010
(6 real changes made)

. replace oecd =1 if countryname=="South Korea" &year> 1996
(20 real changes made)

. replace oecd =1 if countryname=="Mexico" &year> 1994
(22 real changes made)

. replace oecd =1 if countryname=="New Zealand" 
(42 real changes made)

. replace oecd =1 if countryname=="Poland" &year> 1996
(20 real changes made)

. replace oecd =1 if countryname=="Slovakia" &year> 2000
(16 real changes made)

. replace oecd =1 if countryname=="Slovenia" &year> 2010
(6 real changes made)

. keep if oecd==1
(5,452 observations deleted)

. 
. bysort countryname: egen l1_sd = sd(l1)

. bysort countryname: egen l2_sd = sd(l2)

. bysort countryname: egen j_sd = sd(j)

. bysort countryname: egen f_sd = sd(f)

. bysort countryname: egen polconv_sd = sd(polconv)

. 
. gen any_institutional_change=0

. replace any_institutional_change=1 if l1_sd>0 | l2_sd>0 | j_sd>0 | f_sd>0
(274 real changes made)

. 
. gen any_polconv_change=0

. replace any_polconv_change=1 if polconv_sd>0
(1,011 real changes made)

. 
. bysort countryname: egen any_polconv_change_country = max(any_polconv_change)

. 
. 
. by countryname, sort: gen nvals = _n == 1 

. count if nvals==1 & any_polconv_change==1 & any_institutional_change==0 //countries without institutional change: 23
  23

. count if nvals==1 & any_polconv_change==1 & any_institutional_change==1 //countries with institutional change 7
  7

. collapse (sd) polconv  , by(countryname)

. sum polconv //mean within-country standard deviation of PolConV for OECD countries (country-year observations, 1975-2016 when countrie
> s in OECD): 0.04

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     polconv |         30    .0424043     .073701   .0001753   .2401149

. 
. clear

. 
. use "./working data/polcon_2017_wd.dta"

. merge 1:1 countryname year using "./working data/henisz_analysis_country_years.dta"
(note: variable countryname was str18, now str52 to accommodate using data's values)
(note: variable year was int, now double to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         5,394
        from master                     5,394  (_merge==1)
        from using                          0  (_merge==2)

    matched                             1,069  (_merge==3)
    -----------------------------------------

. 
. tab _merge

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
        master only (1) |      5,394       83.46       83.46
            matched (3) |      1,069       16.54      100.00
------------------------+-----------------------------------
                  Total |      6,463      100.00

. keep if _merge==3
(5,394 observations deleted)

. sort countryname year

. 
. bysort countryname: egen l1_sd = sd(l1)

. bysort countryname: egen l2_sd = sd(l2)

. bysort countryname: egen j_sd = sd(j)

. bysort countryname: egen f_sd = sd(f)

. bysort countryname: egen polconv_sd = sd(polconv)

. 
. gen any_institutional_change=0

. replace any_institutional_change=1 if l1_sd>0 | l2_sd>0 | j_sd>0 | f_sd>0
(718 real changes made)

. 
. gen any_polconv_change=0

. replace any_polconv_change=1 if polconv_sd>0
(1,060 real changes made)

. 
. bysort countryname: egen any_polconv_change_country = max(any_polconv_change)

. 
. 
. by countryname, sort: gen nvals = _n == 1 

. 
. 
. count if any_polconv_change==1 & any_institutional_change==0 //number of observations accounted for by countries without instutional c
> hange: 342
  342

. count if any_polconv_change==1 & any_institutional_change==1 //number of observations accounted for by countries without instutional c
> hange: 718
  718

. 
. collapse (sd) polconv  , by(countryname)

. sum polconv //mean within-country standard deviation of PolConV for countries in main sample: 0.13

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     polconv |         57    .1262422     .084955          0   .2964277

. ////////////////////
> 
. 
. log close
      name:  <unnamed>
       log:  /Users/sebastianthieme/Dropbox/Projects/Developing_Cycles/working data/footnote15_analysis.log
  log type:  text
 closed on:  23 Mar 2023, 18:42:49
----------------------------------------------------------------------------------------------------------------------------------------
